import "package:flutter/material.dart";

class TrianglePainter extends CustomPainter {
    final Color color;
    
    TrianglePainter([this.color = const Color(0xFFf9da92)]);
    
    @override
    void paint(Canvas canvas, Size size) {
        
        // 三角
        Paint paint = new Paint()
            ..color = color
            ..strokeCap = StrokeCap.round
            ..style = PaintingStyle.fill
            ..strokeWidth = 1;
        Path path = Path();
        path.moveTo(size.width, 0);
        path.lineTo(size.width, size.height);
        path.lineTo(0, size.height);
        path.close();
        canvas.drawPath(path, paint);
    }
    
    @override
    bool shouldRepaint(CustomPainter oldDelegate) => false;
}